package com.ruoyi.app.mapper;

import com.ruoyi.app.domain.TripThumbs;
import com.ruoyi.app.domain.TripThumbsExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface TripThumbsMapper {
    int countByExample(TripThumbsExample example);

    int deleteByExample(TripThumbsExample example);

    int deleteByPrimaryKey(Long id);

    int insert(TripThumbs record);

    int insertSelective(TripThumbs record);

    List<TripThumbs> selectByExample(TripThumbsExample example);

    TripThumbs selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") TripThumbs record, @Param("example") TripThumbsExample example);

    int updateByExample(@Param("record") TripThumbs record, @Param("example") TripThumbsExample example);

    int updateByPrimaryKeySelective(TripThumbs record);

    int updateByPrimaryKey(TripThumbs record);


    @Update("UPDATE trip_info SET trip_thumbs = COALESCE ( trip_thumbs, 0 ) + 1 WHERE id = #{id}")
    int upTripInfoThumbs(Long id);

    @Update("UPDATE trip_info SET trip_thumbs = GREATEST(COALESCE(trip_thumbs, 0) - 1, 0) WHERE id = #{id}")
    int downTripInfoThumbs(Long id);

    List<TripThumbs> selectList(Long tripId);

    List<TripThumbs> selectMessageList(Long userId);

    int delMessageList(@Param("ids") List<Long> thumbsReadyList);

}